(function(){
	window.companyCom_more=Class.extend({
		 init:function(params){
			  this.ele=params.ele;
			  this.type=params.type;
			  this.bind=params.bind;
			  this.run();
		 },
		 run:function(){
			 var selt=this
			  $(selt.ele).each(function(index, element) {
                  var T=$(this);
				  var url=T.data("url");
				  var method=T.attr("method");
				  var ngclass=T.attr("ng-class");
				  var ngbind=T.attr("ng-bind");
				  T.on(ngbind,function(){
					  var ngpage=T.attr("ng-page");
					  if (ngpage>1) {
					  $.ajax({
							type: ''?"post":method,
							url: url,
							data:{page:ngpage},
							dataType: "json",
							success: function(data) {
								$(data.html).appendTo(selt.bind);
								if(data.hasMore == false) {
									T.attr("ng-page",0);
									 if(selt.type==1){
									   T.addClass("over").text("加载更多")
									 }
									 if(selt.type==2){
									   T.html("")
									 }
								}
								else
								{
									T.attr("ng-page",parseInt(ngpage)+ 1);
									
								}
							},
							error: function(XMLHttpRequest, textStatus, errorThrown) {
								alert(errorThrown);
							}
						});
					  }
					  
				  })
				 
				
            });
		 }
	})
})()


